#define _CRT_SECURE_NO_WARNINGS 1


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

void Teamuptocompete()
{
    int n;
    cin >> n;
    vector<int> v(3 * n);
    for (size_t i = 0; i < v.size(); i++)
    {
        cin >> v[i];
    }

    sort(v.begin(), v.end());

    long long ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans += v[v.size() - 2 * (i + 1)];
    }

    cout << ans << endl;
}

void Removecommoncharacters()
{
    string s1, s2;
    getline(cin, s1);
    getline(cin, s2);

    vector<int> v(257);

    for (auto ch : s2)
    {
        v[ch]++;
    }

    string ans;
    for (auto ch : s1)
    {
        if (v[ch] == 0)
        {
            ans += ch;
        }
    }

    cout << ans << endl;
}

void Sortsubsequences()
{
    int m;
    cin >> m;
    vector<int> v;
    int val;
    int ans = 0;
    for (int i = 0; i < m; i++)
    {
        cin >> val;
        v.push_back(val);
    }


    for (int i = 0; i < m; i++)
    {
        if (i == m - 1)
        {
            ans++;
            break;
        }
        if (v[i] < v[i + 1])
        {
            while (i < (m - 1) && v[i] < v[i + 1])
            {
                i++;
            }
            ans++;
        }
        else if (v[i] > v[i + 1])
        {
            while (i < (m - 1) && v[i] > v[i + 1])
            {
                i++;
            }
            ans++;
        }
    }

    cout << ans << endl;
}

void reversestr()
{
    string s;
    getline(cin, s);
    reverse(s.begin(), s.end());


    auto start = s.begin();
    while (start != s.end())
    {
        auto end = start;
        while (end != s.end() && *end != ' ')
        {
            end++;
        }

        reverse(start, end);
        if (end != s.end())start = end + 1;
        else start = end;
    }

    cout << s << endl;
}


int main()
{
	




	return 0;
}